unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;


type
  TForm1 = class(TForm)
    Image1: TImage;
    procedure Image1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  Figure = class
      x, y: Integer;
      procedure Draw() ; virtual;
  end;

  Square = class(Figure)
      a : Integer;
      procedure Draw(); override;
  end;

  FixedSquare = class(square)
      constructor create(corx, cory, aa : Integer);
  end;

  RandomSquare = class (square)
      constructor create();
  end;

  Circle = class(Figure)
    R : Integer;
    color : Integer;
    constructor create(colorA : Integer);
    procedure Draw(); override;
  end;



var
  Form1: TForm1;

implementation

{$R *.dfm}

{ Figure }

procedure Figure.Draw;
begin

end;

{ square }

procedure Square.Draw;
begin
  inherited;
  Form1.Image1.Canvas.Rectangle(x, y, x + a, y + a);

end;

{ FixedSquare }

constructor FixedSquare.Create(corx, cory,  aa: Integer);
begin
    x := corx;
    y := cory;
    a := aa;
end;

{ RandomSquare }

constructor RandomSquare.Create;
begin
    x := random(1000);
    y := random(1000);
    a := random(50);
end;

procedure Circle.Draw;
begin
    Form1.Image1.Canvas.Brush.Color := color;
    Form1.Image1.Canvas.Ellipse(x, y, x + 2 * R, y + 2 * R);
end;

constructor Circle.create(colora : Integer);
begin
    color :=  colora;
    r := random(50);
    x := random(1000);
    y := random(1000);
end;

var
  Mas : array [0..100] of Figure;
  I : Integer;



procedure TForm1.Image1Click(Sender: TObject);
begin
  Randomize;
  For I := 0 to 24 do
    Begin
      Mas[I] := FixedSquare.Create(random(500), random(500), random(50));
      Mas[I].Draw;

    End;
  For I := 25 to 49 do
    Begin
      Mas[I] := RandomSquare.Create();
      Mas[I].Draw;
    End;
  For I := 50 to 99 do
    Begin
      Mas[I] := Circle.Create(random(100000));
      Mas[I].Draw;
    End;

end;

{ Circle }



end.





